#ifndef SCRIPT_H
#define SCRIPT_H

#include <QScriptEngine>

class Script
{
public:
    static Script* getInstance();

private:
    Script();
    ~Script();
    /*********************************************************************
     *                          Run
     * *******************************************************************/
public:
    enum ContextType {
        InitialContext,
        CurrentContext,
        NewContext,
        TemporaryContext
    };

    QScriptValue runCode(const QString &program, ContextType contextType=CurrentContext);
    void pushContext();
    void popContext();
    QScriptEngine* engine(){
        return engine_;
    }

private:
    QScriptEngine *engine_;
    QScriptEngineAgent *agent_;
};

#endif // SCRIPT_H
